package com.sy.simpleegg.platform.kkb.api

import com.sy.simpleegg.platform.ychsdk.bean.init.PreRegistResponse
import com.sy.simpleegg.platform.ychsdk.bean.init.RegistNumResponse
import com.sy.simpleegg.platform.ychsdk.bean.login.GetRegisterNumData
import com.sy.simpleegg.platform.ychsdk.bean.login.RegisterData
import com.ych.ytdevicesdk.api.BaseResult
import io.reactivex.Observable
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.POST


interface IInitApi {
    /**
     * 连接测试
     *
     * @param map Account 账号 Password 密码
     * @return 网络响应
     */
    @GET("/Hardware/api/v1.0/Pay/ConnectTest")
    fun connectTest(): Observable<BaseResult<Any?>?>?

    /**
     * 申请临时注册号
     *
     * @param token token
     * @param map   {
     * "MacID": "5c9a0045-7bd5-5f8e-41c1-2295e891df98"
     * "PayDeviceType": "1"
     * "Sign": "5c9a0045-7bd5-5f8e-41c1-2295e891df98"
     * "TS": "1724035009"
     * "HardNum": "0"
     * "CoinELevel": "1"
     * "TicketELevel": "1"
     * "TicketEyeELevel": "1"
     * "NetIP": ""
     * "NetMask": ""
     * "NetGateWay": ""
     * "BusinessNum": ""
     * }
     * @return Object
     */
    @POST("/Hardware/api/v1.0/Pay/GetRegistNum")
    fun getRegistNum(
        @Header("Authorization") token: String?,
        @Body map: Map<String?, Any?>?,
    ): Observable<BaseResult<RegistNumResponse?>?>?


    /**
     * 注册
     *
     * @param map {
     *      * "MacID": "5c9a0045-7bd5-5f8e-41c1-2295e891df98"
     *      * "ShowNum": "1"
     *      * "PayDeviceType": "3"
     *      * "Sign": "5c9a0045-7bd5-5f8e-41c1-2295e891df98"
     *      * "TS": "1724035009"
     *      * }
     * @return
     */
    @POST("/Hardware/api/v1.0/Pay/PreRegist")
    fun preRegist(@Body map: Map<String?, Any?>?): Observable<BaseResult<PreRegistResponse?>?>?


    /**
     * 获取预注册号
     *
     * @param map {
     * MacID：设备唯一ID，
     * PayDeviceType:卡头类型,1=卡头,2=油菜盒子3=兑币机,
     * Sign:签名,
     * TS:当前时间（unix时间戳 单位s）,
     * HardNum:不超过8位,非油菜盒子为0,
     * CoinELevel:设备检测到的电平0=低，1=高.
     * TicketELevel:马达电平0=低，1=高,
     * TicketEyeELevel:光眼电平0=低，1=高,
     * NetIP:IP,
     * NetMask:子网掩码，
     * NetGateWay：网关，
     * BusinessNum：门店编号,来自配网参数
     * }
     * @return
     */
    @POST("/Hardware/api/v1.0/Pay/GetRegistNum")
    fun getRegisterAdvanceNum(@Body map: Map<String?, Any?>?): Observable<BaseResult<GetRegisterNumData?>?>?

    /**
     * 设备预注册
     *
     * @param map {
     * MacID：设备唯一ID，
     * PayDeviceType：卡头类型,1=卡头,2=油菜盒子,3=兑币机，
     * ShowNum：显示序号,如非0表示保留号码,不分配，
     * Sign：签名，
     * TS：当前时间（unix时间戳 单位s）
     * }
     * @return
     */
    @POST("/Hardware/api/v1.0/Pay/PreRegist")
    fun registerDevice(@Body map: Map<String?, Any?>?): Observable<BaseResult<RegisterData?>?>?


    /**
     * 提交设备日志 - 业务系统
     * @param token Token
     * @param map   请求体
     * @return
     */
    @POST("/Iot/api/v1/Device/Log")
    fun pushDeviceLog(
        @Header("Authorization") token: String?,
        @Body map: Map<String?, Any?>?,
    ): Observable<BaseResult<Any?>?>?
}
